<!--<?php
include_once PrintEot('header');
if($action=="new" || $action=="edit"){
print <<<EOT
-->
<form action="$admin_file" method="post" name="form" onsubmit="return checkfrm();">
<input type="hidden" name="action" value="save"/>
<input type="hidden" name="curid" value="$curid"/>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border=0 ID="Table22">
	<TBODY>
		<TR >
			<TD class="tittab" BACKGROUND="$imgpath/admin/menu_bg.gif"><strong><img src="$imgpath/admin/view.gif" width="15" height="13" align="absmiddle"> 新增/编辑　销售机会</strong></TD>
		</TR>
	</TBODY>
</TABLE>
<table cellspacing=0 cellpadding=0 width="100%" border=0 id="Table23">  
    <tbody>
      <tr>
        <td valign=top>
		<div class="addpro">
		<table cellspacing=0 cellpadding=4 width="100%" border=0 align=center id="Table24">
        <tbody>
       			<tr>
					<td align=right>机会编号：</td>
					<td><input type="text"  id="chance_no" name="chance_no" style="WIDTH: 261px" value="$db_chance[chance_no]"></td>
				</tr>        
       			<tr>
					<td align=right>机会主题：</td>
					<td><input type="text"  id="title" style="WIDTH: 261px" NAME="title" value="$db_chance[title]"></td>
				</tr>
				<tr>
					<td align=right>客户简称：</td>
					<td><input type="text"  id="nickname" name="nickname" style="WIDTH: 261px" value="$db_chance[nickname]"></td>
				</tr>
				<tr>
					<td align=right>需求类型：</td>
					<td>
<!-- 
EOT;
	if(!isset($db_chance) || $db_chance[require_type]==0){
		echo '<input type="radio" name="require_type" ID="require_type" value="0" checked/>不明确';
	}else{
		echo '<input type="radio" name="require_type" ID="require_type" value="0"/>不明确';
	}
	if($db_chance[require_type]==1){
		echo '<input type="radio" name="require_type" ID="require_type" value="1" checked/>CPC';
	}else{
		echo '<input type="radio" name="require_type" ID="require_type" value="1"/>CPC';
	}
	if($db_chance[request_type]==2){
		echo '<input type="radio" name="require_type" ID="require_type" value="2" checked/>CPM';
	}else{
		echo '<input type="radio" name="require_type" ID="require_type" value="2"/>CPM';
	}
	if($db_chance[request_type]==3){
		echo '<input type="radio" name="require_type" ID="require_type" value="3" checked/>CPA';
	}else{
		echo '<input type="radio" name="require_type" ID="require_type" value="3"/>CPA';
	}
	if($db_chance[require_type]==4){
		echo '<input type="radio" name="require_type" ID="require_type" value="4" checked/>CPD';
	}else{
		echo '<input type="radio" name="require_type" ID="require_type" value="4"/>CPD';
	}
	if($db_chance[request_type]==5){
		echo '<input type="radio" name="require_type" ID="require_type" value="5" checked/>多种形式';
	}else{
		echo '<input type="radio" name="require_type" ID="require_type" value="5"/>多种形式';
	}			
print <<<EOT
-->
					</td>
				</tr>
				<tr>
					<td align=right>来源：</td>
					<td><select name="clientsource" ID="clientsource" style="WIDTH: 261px">$op_sourcelist</select></td>
				</tr>
				<tr>
					<td align=right>阶段：</td>
					<td><select id="phase" name="phase" style="WIDTH: 261px">$op_phaselist</select></td>
				</tr>
				<tr>
					<td align=right>可能性：</td>
					<td><div class="select">
<!-- 
EOT;
	if(!isset($db_chance) || $db_chance[status]==0){
		echo '<input type="radio" name="status" ID="status" value="0" checked/>0% ';
	}else{
		echo '<input type="radio" name="status" ID="status" value="0"/>0% ';
	}
	if($db_chance[status]==50){
		echo '<input type="radio" name="status" ID="status" value="50" checked/>50% ';
	}else{
		echo '<input type="radio" name="status" ID="status" value="50"/>50% ';
	}
	if($db_chance[status]==80){
		echo '<input type="radio" name="status" ID="status" value="80" checked/>80% ';
	}else{
		echo '<input type="radio" name="status" ID="status" value="80"/>80% ';
	}
	if($db_chance[status]==100){
		echo '<input type="radio" name="status" ID="status" value="100" checked/>100% ';
	}else{
		echo '<input type="radio" name="status" ID="status" value="100"/>100% ';
	}
print <<<EOT
-->
						</div>
					</td>
				</tr>
				<tr>
					<td align=right>预计签约金额：</td>
					<td>
<!--
EOT;
	if(isset($db_chance)){
		echo '<input type="text" id="est_money" name="est_money" style="WIDTH: 120px" value="'.$db_chance[est_money].'">千元';
	}else{
		echo '<input type="text" id="est_money" name="est_money" style="WIDTH: 120px" value="0">千元';
	}
print <<<EOT
-->			
					</td>
				</tr>
				<tr>
					<td align=right>预计签约时间：</td>
					<td>
<!--
EOT;
	if(isset($db_chance)){
		echo '<input name="sign_date" type="text" readonly id="sign_date" style="WIDTH:120px" value="'.$db_chance[sign_date].'">';
	}else{
		$sdate = date('Y-m-d',$timestamp);
		echo '<input name="sign_date" type="text" readonly id="sign_date" style="WIDTH:120px" value="'.$sdate.'">';
	}
print <<<EOT
--><A href="javascript:OpenCalendar('sign_date', false)"><IMG src="$imgpath/admin/icon-calendar.gif" align="absMiddle" border="0"></A>
					</td>
				</tr>
				<tr>
					<td align=right>销售代表(<font color="red">*</font>)：</td>
					<td>
						<select ID="seller_id" name="seller_id">
						<option value="">请选择...</option>
						$op_sellerlist
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
					<input type="submit"  id="btnSubmit" value=" 确定 " NAME="btnSubmit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
					<input type="button" onclick="history.go(-1);" value=" 取消 ">
					</td>
				</tr>
         
    </tbody>
 </table>
 </div></TD>
  </TR>
 </TBODY>

 </TABLE>
 </form>

<script language=javascript>
function checkfrm()
{
	if(isEmpty($('name').value)){
		alert('机会主题不能为空！');
		$('name').focus();
		return false;
	}
	if(isEmpty($('nickname').value)){
		alert('客户昵称不能为空！');
		$('nickname').focus();
		return false;
	}
	if(isEmpty($('seller_id').value)){
		alert('请选择销售代表！');
		$('seller_id').focus();
		return false;
	}	
	var re = /^\d{0,16}$/;
	if(isEmpty($("est_money").value)==true || $("est_money").value.match(re) == false){
		alert('预计金额必须为数字！');
		$("est_money").focus();
		return false;					
	}
}
</script>
<!-- 
EOT;
}else{
print <<<EOT
-->
<form action="$admin_file" method="post" name="form">

    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td align="left" class="tittab">
                <strong>服务商管理 &gt;&gt; 销售机会</strong>
            </td>
        </tr>
    </table>
    <table id="Table50" border="0" cellpadding="0" cellspacing="1" width="98%" align=center>
        <tr>
            <td>快速查询：<select id="searchtype" name="searchtype">
								<option value="title" selected>主题</option>
								<option value="nickname">客户简称</option>
								<option value="seller_name">销售代表</option>								
							</select>
						<input type="text" ID="searchkey" name="searchkey" value="$searchkey" class="text"/>
						<input type="button" ID="btnQuery" value="查询" />
						</td>
            <td align="right" valign="center">
                <table id="Table51" border="0" cellpadding="0" cellspacing="5" height="30">
                    <input id="Hidden1" name="allSelect" type="hidden" value="all" />
                    <tr>
                        <td align="middle" valign="center">
                            <a href="javascript:document.location.reload();">
                                <img align="absMiddle" border="0" height="15" src="$imgpath/admin/reserch.gif" style="text-decoration: underline"
                                    width="17" /><span style="color: #547054"> 刷新</span></a>
<!--
EOT;
	if($canadd==true){
		showButton(1,'新增',$admin_file.'&action=new'.$transtr);
	}
	if($candel==true){
		showButton(2,'删除','javascript:ConfirmDel("'.$admin_file.'&action=del'.$transtr.'&curpage='.$curpage.'","此操作不可恢复,确认删除吗？");');
	}
print <<<EOT
-->
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="2">
            </td>
        </tr>
    </table>
    <div class="tab">
        <table id="Table52" border="0" cellpadding="3" cellspacing="0" align=center>
            <tr>
                <td align="middle" class="title" height="20" valign="center">序号</td>
                <td align="middle" class="title" height="20" valign="center">
                    <input id="Checkbox1" name="as" onclick="allchecked()" type="checkbox" />全选
                </td>
                <td align="middle" class="title" height="20" valign="center">主题</td>
                <td align="middle" class="title" height="20" valign="center">客户昵称</td>
                <td align="middle" class="title" height="20" valign="center">需求类型</td>
                <td align="middle" class="title" height="20" valign="center">来源</td>
                <td align="middle" class="title" height="20" valign="center">阶段</td>                
                <td align="middle" class="title" height="20" valign="center">可能性</td>   
                <td align="middle" class="title" height="20" valign="center">预计金额</td>               
                <td align="middle" class="title" height="20" valign="center">签约时间</td>
                <td align="middle" class="title" height="20" valign="center">负责人</td>
                <td align="middle" class="title" height="20" valign="center">操作</td>
            </tr>
<!--
EOT;
$curidx = ($curpage-1)*$perpage;
$curpageidx = 0;
$showcount = count($db_merchancelist); 
foreach($db_merchancelist as $merchance ){
		$curidx = $curidx+1;
		$curpageidx = $curpageidx+1;
		$db_merchancerequesttype = $cfg_merchtype[$merchance[require_type]];
print <<<EOT
-->      
            <tr height="20" onclick="SwitchTd(this,'click',$curpageidx);" onmouseout="SwitchTd(this,'out',$curpageidx);" onmouseover="SwitchTd(this,'over',$curpageidx);" style="cursor: hand">
                <td align="middle" valign="center" height="20">$curidx </td>
                <td align="middle" valign="center">
                    <input id="ids" name="ids" type="checkbox" value="$merchance[id]" />
                </td>
                <td align="middle" valign="center">&nbsp;$merchance[title]</td>
                <td align="middle" valign="center">&nbsp;$merchance[nickname]</td>
                <td align="middle" valign="center">&nbsp;$db_merchancerequesttype</td>
                <td align="middle" valign="center">&nbsp;$merchance[clientsource]</td>
                <td align="middle" valign="center">&nbsp;$merchance[phase]</td>                
                <td align="middle" valign="center">&nbsp;$merchance[status]%</td>
                <td align="middle" valign="center">&nbsp;$merchance[est_money]千元</td>
                <td align="middle" valign="center">&nbsp;$merchance[sign_date]</td>
                <td align="middle" valign="center">&nbsp;$merchance[seller_name]</td>
                <td align="middle" valign="center">&nbsp;
<!--
EOT;
	showEditButton($merchance[id]);
print <<<EOT
-->
                </td>
            </tr>
<!--
EOT;
}print <<<EOT
-->
        </table>
    </div>
    <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="98%">
        <tr>
            <td>
                &nbsp;</td>
            <td align="right" height="35">
<!--
EOT;
	showPageBreakInfo($showcount);
print <<<EOT
-->
             &nbsp;</td>
        </tr>
    </table>
    <input type="hidden" id="count" name="count" value="$showcount" />

</form>

<!--
EOT;
}?>-->
